package org.rency.mq.activemq.jms.request;

import org.rency.mq.activemq.constant.AcknowledgeMode;
import org.rency.mq.activemq.constant.DeliveryMode;
import org.rency.mq.activemq.constant.MessageFormat;
import org.rency.mq.activemq.request.NotifyRequest;

/**
 * 事务型ACK请求
 *
 * @author: Created by user_rcy@163.com on 2017/3/14.
 * @version: V1.0.0
 * @since JDK 1.8
 */
public class DefaultTransacatedNotifyRequest<T> extends DefaultNotifyRequest<T> implements NotifyRequest<T> {

    private static final long serialVersionUID = -8907492637100399932L;

    public DefaultTransacatedNotifyRequest() {
        setAcknowledgeMode(AcknowledgeMode.SESSION_TRANSACTED);
        setDeliveryMode(DeliveryMode.PERSISTENT);
        setTransacted(true);
    }

    @Deprecated
    public DefaultTransacatedNotifyRequest(Integer actionId, T content) {
        this(actionId, content, MessageFormat.OBJECT);
    }

    @Deprecated
    public DefaultTransacatedNotifyRequest(Integer actionId, T content,
                                           int messageFormat) {
        super(actionId, content, messageFormat);

        setAcknowledgeMode(AcknowledgeMode.SESSION_TRANSACTED);
        setDeliveryMode(DeliveryMode.PERSISTENT);
        setTransacted(true);
    }

}
